Repository navigation
Conversation
log1pf now runs the whole of FreeBSD's s_log1pf.c for finite inputs above -1 instead of mapping negative inputs to -log1p(-x/(1+x)). Compared with the pinned source over every finite float above -1 it has no differing result bit; the old mapping differed on about 82 million inputs, the first at 0xb3000001.
…duction boundaries The expected bits come from the pinned s_log1pf.c.
(cherry picked from commit 87f635c)
(cherry picked from commit 134201f)
log1pf now runs the whole of FreeBSD's s_log1pf.c for finite inputs above -1 instead of mapping negative inputs to -log1p(-x/(1+x)). Compared with the pinned source over every finite float above -1 it has no differing result bit; the old mapping differed on about 82 million inputs, the first at 0xb3000001. (cherry picked from commit ae53b71)
…duction boundaries The expected bits come from the pinned s_log1pf.c. (cherry picked from commit 3fcdc09)
(cherry picked from commit 780fa4b)
…c.prx does (cherry picked from commit 81fa0ec)
# Conflicts: # core/libs/tests/GuestMath.cpp
expf follows lib/msun/src/e_expf.c and log1pf follows lib/msun/src/s_log1pf.c, both at release/11.4.0. Add their source line, the float-conversion credit and the Sun notice as those files carry them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/dev/debt/libc.md
main's boykopovar#21714 set expf's ERANGE in the Math.cpp expf this branch replaces. The branch's msun expf in MathExpf.cpp keeps the console's errno (overflow and the underflows the console reports; guest_math pins those bits), so the Math.cpp definition stays removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
expfnow preserves the scalar bundled-libc algorithm's results and floating-point side effects across caller rounding modes. It uses the existing msun-derived reduction and polynomial, with the native range branches, evaluation order and fixed binary32 constants._Feraise(8)and returns positive infinity. The explicit underflow branch calls_Feraise(16)before the final multiplication; the general subnormal path leaves errno unchanged.huge + xinexact trigger.1 + (x - ratio)order. Exact hexadecimal float constants avoid runtime double-to-float conversion under directed rounding.MathExpf.cppretains the existing Sun/msun licence and attribution, with source-scoped-frounding-mathand-ffp-contract=off.The
log1pfprerequisite from boykopovar#10007 and its authored history remain intentionally retained. This updates the existing PR; no duplicate expf implementation PR is created.Tested
Current-head Linux validation (2026-11-27):
f876efc0ef1c529370c6304149e3adb8443e27f4merges mainf73d791b3df4dcaa773297a93f5ae2c062ee95a3and retains main's scalar and fusedlogfpaths alongside this PR's dedicatedMathExpf.cpp. All six targeted Linux x86-64 Release CTests passed with zero skips. Theguest_expf_environmentsuite passed all 1,128 checks, and the dedicated source retained-frounding-math -ffp-contract=off. Exact-head Linux report.Historical CMake maintenance (2026-11-26): head
996aaa42e5f8c7d72bf09031e317b2c9e7228bcfmerges main79e4f35199fa93b44e4689f391f603dec5b702cb. The maintenance commit changes only CMake placement: the expf source/flag blocks avoid the gamma insertion points, andguest_expf_environmentmoves into an independent test fragment with its originalBUILD_TESTINGguard.MathExpf.cppandGuestExpfEnvironment.cppremain byte-identical to public head86fc4fc9c2f0.A fresh Linux x86-64 / GCC 16.2.1 / Release Ninja build of raw libc/kernel and four focused executables passes.
guest_expf_environment,guest_math,guest_math_elementaryandguest_floating_pointpass, 4/4, zero skips. The CTest backtrace confirms registration from the new fragment; Ninja retains-frounding-mathand-ffp-contract=off; actual raw-provider loading and unchanged input hashes are verified. Conventions, debt-fold and whitespace checks pass. Full Git pair merges with boykopovar#10226 (ca8a86166e6f), boykopovar#24306 (0fbd95fdc9d6) and boykopovar#24360 (53137577143a) are clean; the gamma pairs conflicted in CMake before this maintenance. These are merge checks, not new gamma runtime tests.Maintenance patch, build/test helpers, compiler flags, registration/loader receipts, logs and JUnit — anonymous download and all 20 payload hashes verified; SHA-256
8bd6922de236eda39482f5021367095aca6bfebed52f2d09464650455e5c2ce8. This maintenance validation did not rerun the full patched SDK, Windows, original-module differential, console, title/GPU or performance checks. Earlier mathematical validation remains pinned to the revisions below.Earlier refresh: merged upstream
786bc3afa1c874f98ec2990eb58179a99eeb425cas86fc4fc9c2f04da5210c6cf23a69aa2f4eed05ce. The CMake conflict keeps both this PR'sguest_expf_environmentregistration and main'sguest_lgamma_polesregistration, including their separate Windows environment blocks. The productionMathExpf.cpp, golden fixture and debt fragment are byte-identical to the corrected prior head61549d86.At that earlier pin on Linux 7.3.5-arch1-1, the complete patched/raw SDK and relinker build pass. All five focused CPU groups pass:
guest_math,guest_math_exact,guest_dinkumware_internals,guest_floating_point,guest_expf_environment. Source, configuration and submodules were restored. Current-main patch, build provenance, frozen SDK hashes and verbose test logs, SHA-256811511ebd9c391badddb43bf75489f38728e09bbf92f8ebe24bf11134a634ee8; downloaded again and verified all 19 payload hashes plus the manifest. Hosted CI was pending when that refreshed-pin report was written. The Windows owner also reports the earlier public head86fc4fc9c2f0merged onto main87b7ef3891asc553316ef1:guest_expf_environment,guest_lgamma_polesandguest_mathall pass in each of three runs on Windows 11 Enterprise 22621 / WinLibs GCC 15.2 UCRT Release. This is a three-group Windows check, not a claim that the whole Windows suite ran. Owner report.The original differential and trap measurements below remain historical evidence at their named pins.
Arch Linux x86-64, GCC 16.2.1, Release. Main
7fa48cd1c6cda62b4ebe86575085199a33e08c1d; old public boykopovar#10113ea1052637d616b6ec43ed9fd0ec4ed90f971f2a6; corrected head61549d86c2a61edbd005d9b441748b3d9bd906aa. Comparisons use frozen private merges of the public branches onto that main. The old-PR composition and the corrected head's pre-fix parent have identical source trees.Full SDK
libs, relinker and four existing CPU groups built and passed on main, main plus old boykopovar#10113, and main plus boykopovar#21714. The correction also passes the newguest_expf_environmenttest: 1,128 result/flag/errno/control checks, including a pending divide-by-zero flag. All five groups pass. The exact same new executable fails against both main and old boykopovar#10113 raw test libraries, then passes with the correction; loader paths are verified and loader failures are excluded.Actual patched SDK versus the original converted PPSA21564 libc export (
ab860676108827e0983eefbde3a711b5ce8e20f0b24b492498b6e04cb23c6130): 6,906 inputs × three x87 precisions × four rounding modes × four DAZ/FTZ states × two pending states = 662,976 comparisons per bank. Both function owners are checked by device/inode, reference outcomes are identical across providers, and banks/modules/probe hashes remain unchanged.Caller control differences: zero for every bank. The SDK's
__erroraliases host errno on this Linux machine, so the two logged errno columns are one channel, not independent measurements.A separate Linux child-process comparison enables exception traps in both x87 and SSE: 144 reference/SDK pairs, checking first-trap signal, flags, errno, result and controls. Old boykopovar#10113 has 96 mismatches; the correction has zero. Original-module dependencies, including
_Feraise, still come from each SDK, so this does not independently establish console/helper conformance.Complete evidence, source patches and reproducers — SHA-256
eb013afbaf76b1a234a17402ee3c0afc5befd14cf1543813613bdcbe88903bf1, 166 payloads; downloaded and every payload verified. Original binaries, original assembly, game assets, SDK binaries and caches are excluded.Conventions pass; the merge-tree check against current main is clean. The official overlap scan and pinned manual comparisons are included. boykopovar#10226 is the dependent erff/erfcf child; boykopovar#21714 is a tested alternative, not a dependency; boykopovar#19434 forwards a separate library surface; boykopovar#24322 splits source files. The gamma PRs share independent additive CMake registrations. All fifteen fail-closed primary patches match previously reviewed pins, and the two additional shared test hunks concern nextafter/nexttoward and double lgamma only.
These are sampled Linux CPU measurements, not a new exhaustive all-float result. Prior Windows/macOS reports on the old public head remain historical. The separate Windows owner report above covers three focused groups on the refreshed head composed with its named main; it does not reproduce the original-module differential or trap comparisons. No new macOS qualification is available. FMA-contracted title variants can retain different last bits, as documented in debt. No console execution, game unblock, GPU, loading-time or FPS improvement is claimed.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Summary by CodeRabbit
expfresults across normal and very small inputs, including overflow, underflow, and subnormal cases.expfbehavior across rounding modes and floating-point exception conditions.log1pfresults for finite inputs within its valid range, while retaining handling for values outside that range.